Github Actions and BlazeMeter-related Functions

GitHub Actions facilitates the execution of various functions that you can use for testing with BlazeMeter. This topic outlines each of these functions, accompanied by the corresponding syntax to use within the action.yml file.

Create a New Test

To create and execute a new test in BlazeMeter, configure actions.yml as follows:

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx" 
	createTest: "true" 
	inputStartFile: "xxxx" 
	testName: "xxxx" 
	projectID: "xxxx"
	continuePipeline: "false" 
	showTailLog: "false"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}} 
				createTest: ${{env.createTest}}
				inputStartFile: ${{env.inputStartFile}} 
				testName: ${{env.testName}}
				projectID: ${{env.projectID}} 
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
			
Uses: actions/checkout@v2.3.4 - This dependency to the working folder is required for uploading files on BlazeMeter.

Run an Existing Test

To run an existing BlazeMeter test, configure actions.yml as follows:

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx" 
	testID: "xxxx"
	continuePipeline: "false" 
	showTailLog: "false"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}} 
				testID: ${{env.testID}} 
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
			

Upload or Update Existing Test Files

Before running a test, replace or add the dependency files.

If an existing BlazeMeter test requires dependent files, to upload those files to an existing test and run it, configure actions.yml as follows.

If your test requires multiple files to be uploaded, you must put all those files under a folder and reference the folder path inside the inputAllFiles variable.

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx" 
	testID: "true" 
	inputAllFiles: "xxxx" 
	uploadFileCheck: "true" 
	continuePipeline: "false" 
	showTailLog: "false"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}} 
				testID: ${{env.testID}}
				inputAllFiles: ${{env.inputAllFiles}} 
				uploadFileCheck: ${{env.uploadFileCheck}}
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
			

Replace or Add the Configuration Files (main test file) Before Running a Test

To update the main test file of an existing test and run it, configure actions.yml as follows:

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx" 
	testID: "true" 
	inputStartFile: "xxxx" 
	uploadFileCheck: "true" 
	continuePipeline: "false" 
	showTailLog: "false"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}} 
				testID: ${{env.testID}}
				inputAllFiles: ${{env.inputAllFiles}} 
				uploadFileCheck: ${{env.uploadFileCheck}}
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
			

Update Variables in Taurus Files

If your test is defined as a Taurus .yaml file and it contains variables that you would like to be updated at run time, use the envVariable feature.

Let’s assume you have a variable called username in your Taurus YAML file and you want the value of that variable to be set to jdoe. You can do so by passing the key-value pair as username:jdoe, which then replaces the variable username in your .yml file with the value jdoe. This function works only in combination with the inputStartFile variable, which means that the file gets updated locally on the runner and the updated file gets uploaded to your BlazeMeter test before execution.

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx" 
	inputStartFile: "xxxx" 
	createTest: "true"
	testName: "xxxx"
	projectID: "xxxx"		 	
	envVariable: '{"key": "\"value\""}'
	continuePipeline: "false" 
	showTailLog: "false"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}} 
				inputStartFile: ${{env.StartFile}}
				createTest: ${{env.createTest}}
				testName: ${{env.testName}}
				projectID: ${{env.projectID}} 
				envVariable: ${{env.envVariable}}
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
			

Run Existing Test and Download Artifacts Log File

To run an existing test and then download the artifacts to the CI Project directory, configure actions.yml as follows:

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx" 
	testID: "xxxx"
	continuePipeline: "false" 
	showTailLog: "false"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}} 
				testID: ${{env.testID}} 
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
			

Add JMeter Properties

If your test is JMeter-based and you would like to add or update a JMeter property, you can do so by using the jmeterProperties variable as shown in the example below.

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx" 
	testID: "xxxx"
	jmeterProperties: "key=value" 
	continuePipeline: "false" 
	showTailLog: "false"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}}
			 	jmeterProperties: ${{env.jmeterProperties}}
				testID: ${{env.testID}} 
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
			

Customize a Report Name

Use the reportName parameter to give a name to your test report.

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx" 
	testID: "xxxx"
	reportName: "xxxx"
	continuePipeline: "false" 
	showTailLog: "false"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}}
			 	testID: ${{env.testID}}
				reportName: ${{env.reportName}}
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
			

Add Notes to your Test Report

To add notes to your test report, use the notes parameter.

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx" 
	testID: "xxxx"
	notes: "xxxx"
	continuePipeline: "false" 
	showTailLog: "false"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}}
			 	testID: ${{env.testID}} 
				notes: ${{env.reportName}}
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
			

Override the Iterations Configuration in Existing JMeter Tests

If your JMeter test is iteration-based and not duration-based, you can override the iterations value in the JMX through the use of the variables iterationsConfig and iterations as shown in the example below.

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx" 
	testID: "xxxx"
	iterationsConfig: "true" 
	iterations: "xxxx"
	continuePipeline: "false" 
	showTailLog: "false"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}}
			 	testID: ${{env.testID}} 
				iterationsConfig: ${{env.iterationsConfig}}
				iterations: ${{env.iterations}}
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
			

Override the Iterations Configuration in JMX and Create a New Test

This function is similar to the previous one except that it also creates a new test on the fly.

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx" 
	createTest: "true" 
	inputStartFile: "xxxx" 
	testName: "xxxx" 
	projectID: "xxx"
	iterationsConfig: "true" 
	iterations: "xxxx"
	continuePipeline: "false" 
	showTailLog: "false"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}}
				createTest: ${{env.createTest}}
				inputStartFile: ${{env.inputStartFile}} 
				testName: ${{env.testName}}
				projectID: ${{env.projectID}}  
				iterationsConfig: ${{env.iterationsConfig}}
				iterations: ${{env.iterations}}
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
			

Override the Load Configuration Parameters - Concurrency, Ramp Up and Duration

To override the load configuration parameters, configure actions.yml as follows:

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx" 
	createTest: "true" 
	inputStartFile: "xxxx" 
	testName: "xxxx" 
	projectID: "xxx"
	totalUsers: "xxxx" 
	duration: "xxxx" 
	rampUp: "xxxx"
	continuePipeline: "false" 
	showTailLog: "false"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}}
				createTest: ${{env.createTest}}
				inputStartFile: ${{env.inputStartFile}} 
				testName: ${{env.testName}}
				projectID: ${{env.projectID}}  
				totalUsers: ${{env.totalUsers}} 
				duration: ${{env.duration}} 
				rampUp: ${{env.rampUp}}
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
			

Update Test Data

This function is specific to Scriptless Functional Tests that leverage the Test Data feature. When you use the Test Data module in your tests, you are basically referencing variables in your test that are managed by the Test Data module. These variable values can be overridden from your pipeline by use of the modelData parameter. It requires the use of key-value pairs as shown below.

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx" 
	testID: "xxxx"
	modelData: '{"key": "\"value\""}' 
	continuePipeline: "false" 
	showTailLog: "false"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}}
				testID: ${{env.testID}}
				modelData: ${{ toJSON(env.modelData) }} 
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
			

Run an Existing Test by Passing the Test Name instead of Test ID

You can execute tests by passing the Test Name as opposed to a Test ID as shown below. If the Test Name passed does not exist on the BlazeMeter side, the job fails with an error message.

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx"  
	continuePipeline: "false" 
	showTailLog: "false"
	testName: "xxxx" 
	projectID: "xxxx" 
	testRunByTestName: "true"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}}
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
				testName: ${{env.testName}} 
				projectID: ${{env.projectID}}
				testRunByTestName:  ${{env.testRunByTestName}}
			

Pass First Job Result to Another Job

Follow the configuration below to pass the first job result to use in another job.

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx"
	testID: "xxxx"  
	continuePipeline: "false" 
	showTailLog: "false"
	ignoreSLA: "true"

on: push 
jobs:
	first-job:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}}
				testID: ${{env.testID}}
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
				ignoreSLA: ${{env.ignoreSLA}}
		-	name: powershell 
			id: identify 
			shell: pwsh
				run: |
					$results = Get-Content -Path results
					echo "::set-output name=results::$results" 
		outputs:
			results: ${{ steps.identify.outputs.results }} 
	second-job:
		needs: first-job
		runs-on: ubuntu-latest 
		steps:
			-	name: "Get result From first Job" 
				run: |
					echo "display result data"
					echo	'results:	${{	toJSON(fromJSON(needs.first-job.outputs.results))  }}'
			
			

Send Microsoft Teams Webhook Notifications

Use the webhookURL parameter to send Microsoft teams notifications for test start, internal report URL, public report URL, test end and test status.

name: github-action 
env:
	apiKey: "xxxx" 
	apiSecret: "xxxx"  
	continuePipeline: "false" 
	showTailLog: "false"
	testID: "xxxx" 
	webhookURL: "xxxx"

on: push jobs:
	github-action:
		runs-on: ubuntu-latest 
		steps:
			-	name: Checkout
			uses:  actions/checkout@v2.3.4
			-	name: Run Blazemeter test
			uses: BlazeRunner-BZR/Github-Action@v8.1 
			id: run-test
			with:
				apiKey: ${{env.apiKey}} 
				apiSecret: ${{env.apiSecret}}
				continuePipeline: ${{env.continuePipeline}} 
				showTailLog: ${{env.showTailLog}}
				testID: ${{env.testID}} 
				webhookURL: ${{env.webhookURL}}
			
If you have configured Microsoft Teams webhook notifications, then continuePipeline:'false' is a mandatory parameter because jobs are waiting to complete the test to get test status.